# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-consolemd
pkgname=('python2-consolemd' 'python-consolemd')
_pkgname=consolemd
pkgver=0.5.1
pkgrel=7
pkgdesc='ConsoleMD renders markdown to the console.'
arch=('any')
url='https://pypi.org/project/consolemd/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('5eae413b3aa69b1f2d76e6bfca14a3742bab0a5e2b1f37bffa2490d1be02dda73b39fcc86fc70db4d3d737ec64ac018bdde69f19bdf38d15bea05390b8659133')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-consolemd() {
  depends=('python2' 'python2-pygments' 'python2-six' 'python2-setproctitle'
           'python2-commonmark')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build

  mv "$pkgdir/usr/bin/$_pkgname" "$pkgdir/usr/bin/${_pkgname}2"
}

package_python-consolemd() {
  depends=('python' 'python-pygments' 'python-six' 'python-setproctitle'
           'python-commonmark')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

